#include <bolt.h>
#include "l3.h"
#include "pkt_queue.h"
#include "prot_ip.h"

bool ip_rx(struct llbuf *ll)
{
  struct iphdr *iph = (struct iphdr *)ll->l3_ptr;
  ll->daddr = iph->daddr;
  ll->saddr = iph->saddr;
  ll->protocol= iph->protocol;
  ll->version = iph->version;
  ll->l4_ptr = ll->l3_ptr + (iph->ihl << 2);
  ll->l4_size = ntohs(iph->tot_len) - (iph->ihl << 2);
  struct queue_stat *s = get_queue_stat(ll->in);
  if (s != NULL)
    s->ip++;
  return l3_rx(ll);
}    

bool ip_tx(struct llbuf *ll)
{
  return false;
}

